package com.luckynote.common.base.result;

import com.luckynote.common.base.util.BeanUtil;

/**
 * <pre>
 * *********************************************
 * Copyright LUCKY-NOTE.
 * All rights reserved.
 * ****************************************************
 *  Version       Date         Author            Desc
 *    v1.0       2019/6/29      bingo       封装执行结果
 * ****************************************************
 * </pre>
 */
public class ExecuteResult implements IResponseInterface{

    private static final long serialVersionUID = 6110520961704509315L;

    /* 本次操作是否成功 */
    private Boolean successful = new Boolean(true);
    /* 系统响应信息 */
    private ResponseInfo responseInfo;

    @Override
    public Boolean isSuccessful() {
        return this.successful;
    }

    public void setSuccessful(Boolean successful) {
        this.successful = successful;
    }

    public Boolean getSuccessful() {
        return successful;
    }

    @Override
    public ResponseInfo getResponseInfo() {
        return this.responseInfo;
    }
    public void setResponseInfo(ResponseInfo responseInfo) {
        this.responseInfo = responseInfo;
    }

    @Override
    public String toJson() {
        return BeanUtil.toJson(this);
    }

    @Override
    public void cloneResponseInfo(IResponseInterface source) {
        if ( source==null || source.getResponseInfo()==null  )
            return;
        this.setResponseInfo(source.getResponseInfo());
    }
}
